﻿using System.Windows;
using System.Windows.Forms;

namespace RemoteDesktop.Compent
{
    /// <summary>
    /// Toast.xaml 的交互逻辑
    /// </summary>
    public partial class Toast : Window
    {
        MainWindow mWindow;
        public Toast(string text, MainWindow mainWindow)
        {
            InitializeComponent();
            Init(mainWindow);
        }
        private void Init(MainWindow mainWindow)
        {
            mWindow = mainWindow;
            // 显示在顶部中间
            int SLeft = Screen.PrimaryScreen.Bounds.Location.X; // 全屏截图窗体左上角坐标
            int STop = Screen.PrimaryScreen.Bounds.Location.Y;  // 全屏截图窗体左上角坐标
            double SWidth = SystemParameters.PrimaryScreenWidth;
            double SHeight = SystemParameters.PrimaryScreenHeight;
            // int x = (int) (System.Windows.Forms.SystemInformation.WorkingArea.Width - Width) / 2;
            int x = (int)(SWidth - Width) / 2;
            int y = 0;
            this.Top = y; //窗体的位置由Location属性决定
            this.Left = x;         //窗体的起始位置为(x,y)
        }

        private void ChangeWindow_Click(object sender, RoutedEventArgs e)
        {
            mWindow.ToggleFullScreen();
        }

        internal void setAllScreenText(string v)
        {
            ChangeAllScreen.Content = v;
        }

        private void ControlWindow_Click(object sender, RoutedEventArgs e)
        {
            mWindow.IsAddControl = !mWindow.IsAddControl;
            mWindow.AddAndRomoveListener(mWindow.IsAddControl);
        }
        internal void setScreenControlText(string v)
        {
            ControlScreen.Content = v;
        }
    }
}
